module.exports = function (path, data, method) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: 'http://127.0.0.1:8081/api/' + path,
      data: data,
      method: method, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: {
        "Content-Type": "json"
      }, // 设置请求的 header
      success: resolve,
      fail: function () {
        reject()
        wx.showModal({
          title: '失败',
          showCancel: false
        })
      }
    })
  })
}